<div class="ibox">
	<div class="ibox-content">
		<form class="form-horizontal" id="editForm"
			action="${cxt!}/cms/advertisement/update" method="POST">
			<input type="hidden" id="advertisementid" name="advertisement.id" value="${advertisement.id!}">
			<div class="form-group">
				<label for="namebasic" class="col-md-2 control-label">${_res["advert.type"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-md-3 ">
					<#dict type="select" class="form-control" name="advertisement.type" dictCode="ADV_TYPE"
					value="${advertisement.type!}" required="true" />
				</div>

				<label for="namebasic" class="col-md-2 control-label">${_res["advert.positionid"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-md-3 ">
					<#dict type="select" name="advertisement.positionid" table="cms_advertisement_position"
					filedName="name" filedValue="id" value="${advertisement.positionid!}"  required="true"/>
				</div>
			</div>
			<div class="hr-line-dashed"></div>

			<div class="form-group">
				<label for="namebasic" class="col-md-2 control-label">${_res["advert.name"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-md-3 ">
					<input type="text" class="form-control" name="advertisement.name" value="${advertisement.name!}"
						placeholder="${_res['advert.name']}" required aria-required="true">
				</div>

				<label for="namebasic" class="col-md-2 control-label">${_res["advert.keyword"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-md-3 ">
					<input type="text" class="form-control" name="advertisement.keyword" value="${advertisement.keyword!}"
						placeholder="${_res['advert.keyword']}" required aria-required="true">
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			
			<div class="form-group">
				<label for="namebasic" class="col-md-2 control-label">${_res["advert.href"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-md-3 ">
					<input type="text" class="form-control" name="advertisement.href" value="${advertisement.href!}"
						placeholder="${_res['advert.href']}" required aria-required="true" url="true">
				</div>

				<label class="col-sm-2 control-label">${_res["advert.status"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-sm-3">
					<#dict type="select" class="form-control" name="advertisement.status" dictCode="COMMON_STATUS"
					value="${advertisement.status!}" required="true" />
				</div>
			</div>
			<div class="hr-line-dashed"></div>

			<div class="form-group">
				<label class="col-md-2 control-label">${_res["advert.startTime"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-md-3">
					<input class="form-control layer-date laydate-icon" name="advertisement.starttime" value="${advertisement.starttime!}"
						placeholder="${_res['advert.startTime']}" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
						required aria-required="true">
				</div>

				<label class="col-md-2 control-label">${_res["advert.endTime"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-md-3">
					<input class="form-control layer-date laydate-icon" name="advertisement.endtime" value="${advertisement.endtime!}"
						placeholder="${_res['advert.endTime']}" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
						required aria-required="true">
				</div>
			</div>
			<div class="hr-line-dashed"></div>

           	<!-- 上传广告图片-->
           <div class="form-group">
          	 	<label  class="col-md-2 control-label">${_res["advert.picture"]}<span class="fontColorRed">&nbsp;*</span></label>
				<div class="col-md-3 proimgfiles">
					<a href="javascript:void(0)" class="filesIconAdd" id="uploadAdvertFiles">
							<!-- //ajax片段开始 -->
							<%  #ajax uploadAdvertFiles: {%> 
								<% if(uploadFile! !=null) {%> 
									<input type="hidden" name="advertisement.pictures" value="${uploadFile.path!}" required aria-required="true"/> 
									<img src="${imgCxt!}/${uploadFile.path!}" width="100%" height="100%" style="position: relative; z-index: 99999;">
								<% } else { %>
									<img src="${imgCxt!}/${advertisement.pictures!}" width="100%" height="100%" style="position: relative; z-index: 99999;" >
								<% } %>
							<% } %>
							<!-- //ajax片段结尾 -->
					</a> 
					<input type="file" style="opacity: 0" id="file_uploadAdvertFiles" name="contenurl" />
				</div>
		   </div>	
		   <div class="hr-line-dashed"></div>
		   
			<div class="form-group">
				<div class="row">
					<div class="col-md-10 col-md-offset-2">
						<button type="button" class="btn btn-warning" onClick="ajaxContent('/cms/advertisement/list');">${_res["system.return"]}</button>
						<button type="submit" class="btn btn-primary">${_res["system.confirm"]}</button>
						<button type="button" class="btn btn-danger" onClick="ajaxContent('/cms/advertisement/list');">${_res["system.cancel"]}</button>
					</div>
				</div>
			</div>
		</form>
	</div>
</div>
<#submit formId="editForm" divId="content" /> <#nav />


<script>
	$(document).ready(function() {
		$("a[id^='upload']").on('click', function() {
			var id = $(this).attr("id");
			$("#file_" + id).click();
		});
	
		// 选择文件之后执行上传ajaxFileUpload2(divId,fileElementId,toUrl,uploadType,uploadFiles,callback)
		$("input[id^='file_uploadAdvertFiles']").on("change", function() {
			var fileElementId = $(this).attr("id");
			ajaxFileUpload2("uploadAdvertFiles" , fileElementId , "/cms/advertisement/add.html#uploadAdvertFiles" , "advert","");
		});
		
	});
</script>